:host {
  display: block;
  position: absolute;
  z-index: 100;
  font-size: 14px;
  font-family: inherit;
  pointer-events: none;
  --aie-primary-color: #007eea;
}
.truncate{
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.aie-ai-panel-container {
  width: 680px;
  max-width: 90vw;
  overflow: hidden;
  padding: 4px;
  pointer-events: auto;
}
.aie-ai-panel-body {
  padding: 0;
  border-radius: 5px;
  /* box-shadow: 0 0 7px 0 rgba(0, 0, 0, .15); */
  box-shadow: 0 0 4px #00000026;
  border: solid 1px var(--aie-popover-border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--aie-popover-bg-color);
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0 0;
  height: 40px;
  border-bottom: 1px solid var(--aie-popover-border-color);
  background: var(--aie-popover-bg-color);
}
.handlebar {
  height: 20px;
  flex: 1;
  cursor: move;
}
.icon-btn-pin {
  cursor: pointer;
  padding: 4px;
  color: #666;
  display: flex;
  align-items: center;
  border-radius: 4px;
  margin: 4px 0;
}
.icon-btn-pin.pinned {
  background: #eaf3ff;
}
.icon-btn-pin:hover {
  background: var(--aie-menus-item-hover-color);
}
.icon-btn-close {
  display: flex;
  padding: 4px;
  margin: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.icon-btn-close:hover {
  background-color: var(--aie-menus-item-hover-color);
}
.aie-ai-panel-body-content {
  width: 100%;
  position: relative;
  padding: 0;
  background: var(--aie-popover-bg-color);
}
.loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  pointer-events: none;
  opacity: 0.5;
  display: none;
  z-index: 2;
}
.loader svg {
  width: 20px;
  height: 20px;
  color: #000;
  animation: rotate 2s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
textarea#result {
  width: 100%;
  height: 100%;
  min-height: 100px;
  max-height: 300px;
  padding: 15px;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.6em;
  font-family: inherit;
  border: none;
  resize: none;
  color: var(--aie-text-color);
  background-color: var(--aie-popover-bg-color);
}
textarea#result:focus-visible {
  outline: none;
}
.aie-ai-panel-body-input {
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  border-bottom: 1px solid;
  border-bottom-color: var(--aie-input-border-color);
  align-items: center;
  padding: 10px 16px 10px 10px;
  background: var(--aie-popover-bg-color);
}
#prompt {
  flex:1;
  margin: 0 8px 0 0;
  border: none;
  resize: none;
  background: var(--aie-input-bg-color);
  font-size: 14px;
  font-family: inherit;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 4px;
  color: var(--aie-text-color);
}
#prompt::-webkit-input-placeholder {
  color: var(--aie-text-placeholder-color);
  font-size: 14px;
}
#prompt:focus-visible {
  outline: none;
}
button#go {
  outline: none;
  border: none;
  border-radius: 50%;
  padding: 3px;
  background: #f3f3f3;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
button#go svg {
  color: var(--aie-primary-color, #007eea);
  width: 24px;
  height: 24px;
  margin:3px;
}
button#go:hover {
  background: #dadada;
  cursor: pointer;
}
.aie-ai-panel-body-tips {
  width: 100%;
  padding: 10px;
  color: var(--aie-text-color);
  background-color: var(--aie-popover-bg-color);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  font-size: 12px;
  border-top: 1px solid #eee;
}
.aie-ai-panel-body-tips svg {
  width: 16px;
  height: 16px;
  margin-right: 5px;
}
.aie-ai-panel-body-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
  padding-right: 16px;
  border-top: 1px solid #eee;
  background: var(--aie-popover-bg-color);
}
.aie-ai-panel-body-actions > div:last-child {
  display: flex;
  gap: 8px;
}
div#actionHide, div#actionReplace {
  display: flex;
  align-items: center;
  margin: 0 4px 0 0;
  color: dimgray;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
div#actionHide:hover, div#actionReplace:hover {
  background-color: #efefef;
}
button#actionInsert {
  background: var(--aie-primary-color, #007eea);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 12px;
  font-size: 14px;
  border-radius: 3px;
  display: flex;
  align-items: center;
}
button#actionInsert:hover {
  opacity: .9;
}

.aie-ai-panel-body-reference {
  display: flex;
  padding: 10px;
  position: relative;
}
.aie-ai-panel-body-reference .ref-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
}
.aie-ai-panel-body-reference .divider {
  width: 1px;
  height: auto;
  background-color: var(--aie-popover-border-color);
  margin: 0 8px;
}
.ref-icon .icon-reference {
  margin-top:2px;
  margin-right:2px;
}
.aie-ai-panel-body-reference .ref-list {
  flex: 1;
  overflow: auto;
  max-height: 64px;
  color: #666;
  font-size: 12px;
}
.aie-ai-panel-body-reference .ref-list .ref-list-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.aie-ai-panel-body-reference .ref-list .ref-list-item:hover {
  background-color: var(--aie-popover-selected-color);
  /* padding: 0 4px; */
}
.ref-content {
  margin: 2px 0;
  cursor: default;
}
.ref-remove {
  border-radius: 2px;
  cursor: pointer;
  width: 14px;
  height: 14px;
}
.ref-remove svg {
  width: 14px;
  height: 14px;
}
.aie-ai-panel-body-reference .ref-list .ref-list-item:hover .ref-remove {
    color: #333;
}
.aie-ai-panel-body-reference .clear-all {
  margin:auto 0;
  cursor: pointer;
  color: #666;
}

.aie-ai-panel-footer {
  width: fit-content;
  border: solid 1px var(--aie-popover-border-color);
  background: var(--aie-popover-bg-color);
  border-radius: 5px;
  box-shadow: 0 0 6px 0 rgba(0, 0, 0, .15);
  display: flex;
  padding: 10px 0;
  flex-direction: column;
  margin-top: 8px;
}
.aie-ai-panel-footer-tips {
  padding: 5px 10px;
  color: var(--aie-text-color);
  margin-bottom: 5px;
}
.aie-ai-panel-footer hr {
  height: 1px;
  width: 100%;
  margin: 5px 0;
  background-color: var(--aie-popover-border-color);
  border: none;
}
.menu-items-container p {
  width: 100%;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 40px;
  line-height: 40px;
  font-weight: 500;
  font-size: 14px;
  padding: 0 20px;
  color: var(--aie-text-color);
  text-decoration: none;
  font-family: inherit;
}
.menu-items-container p:hover {
  background: var(--aie-popover-selected-color);
}
.menu-items-container p svg {
  width: 20px;
  height: 20px;
  margin-right: 10px;
}
.menu-items-container hr {
  border: none;
  border-top: 1px solid var(--aie-popover-border-color);
  margin: 8px 0;
}

textarea#result::-webkit-scrollbar,
textarea#prompt::-webkit-scrollbar,
.ref-list::-webkit-scrollbar {
  width: 4px;
}
textarea#result::-webkit-scrollbar-thumb,
textarea#prompt::-webkit-scrollbar-thumb,
.ref-list::-webkit-scrollbar-thumb {
  background-color: #c0c0c0;
  border-radius: 2px;
}
